package com.riven.redisson.concurrent;


import org.redisson.api.RedissonClient;

import java.util.Objects;
import java.util.concurrent.locks.Lock;

/**
 * @author riven
 * @since 2025-05-22
 */
public class RedissonLockProvider implements LockProvider {

    private final RedissonClient redissonClient;

    public RedissonLockProvider(RedissonClient redissonClient) {
        this.redissonClient = redissonClient;
    }

    @Override
    public Lock getLock(Object subject) {
        return redissonClient.getLock(Objects.requireNonNull(subject).toString());
    }

}
